package com.linck.im.dao.pool;

import com.zaxxer.hikari.HikariConfig;
import com.zaxxer.hikari.HikariDataSource;
import org.apache.ibatis.datasource.unpooled.UnpooledDataSourceFactory;

/**
 * @author: linck
 * @create: 2021-01-22
 */
public class HikariDataSourceFactory extends UnpooledDataSourceFactory {

    public HikariDataSourceFactory() {
        HikariConfig config = new HikariConfig();
        config.setDriverClassName("org.postgresql.Driver");
        config.setJdbcUrl("jdbc:postgresql://127.0.0.1:5432/im");
        config.setUsername("postgres");
        config.setPassword("root");
        config.setMaximumPoolSize(5);
        this.dataSource = new HikariDataSource(config);
    }
}
